﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="adm_article_list.aspx.cs" Inherits="Admin_article_list"  %>

<%@ Register src="UserControls/AdminPaging.ascx" tagname="AdminPaging" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">

<style type="text/css">
        @import url(js/calendar-blue.css);
    </style>
    <script type='text/javascript' src="js/calendar.js"></script>
    <script type='text/javascript' src="js/calendar-en.js"></script>
    <script type='text/javascript' src="js/calendar-setup.js"></script>


    <script language="javascript" src="js/scw.js"></script>
    <script type='text/javascript'>
       function openWin(aid,ckid) 
        {
        var url="../detail.aspx?aid="+aid+"&ckid="+ckid;
            window.open(url);
        }
    </script> 
		<div class="adm-wrap">
					<h3>
					    <asp:Literal ID="ltrTitle" runat='server'></asp:Literal>
					</h3>
					<div class="article">
						<p class="hi">
                            <asp:Literal ID="ltrWellcome" runat="server"></asp:Literal></p>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:0px;">
						
							<tr>
								<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:0px">
									<tr>
										<td class="clstitle">Search By:</td>
									</tr>
									<tr>
										<td><asp:DropDownList ID="ddlSearchBy" runat="server" CssClass="medium_ex" Width="150px">
                                                <asp:ListItem Value="UTitle">Title</asp:ListItem>
                                                <asp:ListItem Value="UBody">Body</asp:ListItem>
                                            </asp:DropDownList>
                                                    </td>
									</tr>
									<tr>
										<td>
                                            <asp:TextBox ID="txtSearchBy" runat="server" CssClass="medium_ex" Width="150px"></asp:TextBox>
                                            <asp:Button ID="btnSearch" runat="server" CssClass="submitbutton" 
                                                Text="Search" onclick="btnSearch_Click" Width="80px" />
                                        </td>
									</tr>
								</table></td>
								<td>
									<table width="100%" border="0" cellspacing="0" cellpadding="3" 
                                        bgcolor="#e55a5d" style="padding: 0px; border: 0px;">
										<tr>
											<td class="clstitle">Filter By:</td>
											<td class="clstitle">Sort By:</td>
										</tr>
										<tr>
										    <td style="padding: 0; marign: 0;">
										        <table style="border:0px;" cellpadding='0' cellspacing='0'><tr><td>&nbsp;Main Cat&nbsp;</td>
										        <td><asp:DropDownList ID="ddlMainCat" runat="server" CssClass="medium" 
                                                    AutoPostBack="True" 
                                                    onselectedindexchanged="ddlMainCat_SelectedIndexChanged" Width="145px" 
                                                        Font-Size="11px">
                                                </asp:DropDownList></td><td style="padding: 0">
                                                <asp:TextBox ID="txtDateFrom" ReadOnly='true' runat="server" CssClass="medium" Width="100px"></asp:TextBox>
                                                </td><td style="padding: 0"><img id='btnCalendarFrom' class="medium" src="../images/ico_calenda.gif" alt="thoi trang"  
     style="cursor:pointer;" />
     <script type="text/javascript">
                      Calendar.setup(
                        {
                          inputField  : '<%= txtDateFrom.ClientID %>',         // ID of the input field
                          ifFormat: "%d - %m - %Y",    // the date format
                          button      : "btnCalendarFrom"       // ID of the button
                        }
                      );
                    </script>
    </td></tr></table>
                                                </td>
											<td style="padding: 0">
											    &nbsp;<asp:DropDownList ID="ddlSortBy" runat="server" CssClass="small" 
                                                    Width="100px">
                                                    <asp:ListItem Value="">Sort by</asp:ListItem>
                                                    <asp:ListItem Value="UTitle">Title</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
										</tr>
										<tr>
											<td nowrap="nowrap">
											    <table style="border:0px;" cellpadding='0' cellspacing='0'>
											        <tr>
											            <td style="padding: 0">&nbsp;Sub Cat&nbsp;&nbsp;</td>
											            <td><asp:DropDownList ID="ddlSubCat" runat="server" CssClass="medium" Width="145px">
                                                </asp:DropDownList></td>
											            <td style="padding: 0"> <asp:TextBox ID="txtDateTo" ReadOnly='true' runat="server" CssClass="medium" Width="100px"></asp:TextBox></td>
											            <td style="padding: 0">
                                                <img class="medium" id='btnCalendarTo' src="../images/ico_calenda.gif" alt="thoi trang"  
     style="cursor:pointer;" />
    <script type="text/javascript">
                      Calendar.setup(
                        {
                          inputField  : '<%= txtDateTo.ClientID %>',         // ID of the input field
                          ifFormat: "%d - %m - %Y",    // the date format
                          button      : "btnCalendarTo"       // ID of the button
                        }
                      );
                    </script></td>
											        </tr>
											    </table>
											
											</td>
											<td nowrap="nowrap" style="padding: 0px;">
											    <table style="border:0px;">
											        <tr>
											            <td><asp:DropDownList ID="ddlSortOrder" runat="server" CssClass="small" 
                                                                Width="100px">
                                                    <asp:ListItem Value="">Sort Order
                                                    </asp:ListItem>
                                                    <asp:ListItem Value="ASC">A-Z</asp:ListItem>
                                                    <asp:ListItem Value="DESC">Z-A</asp:ListItem>
                                                </asp:DropDownList></td>
											            <td> 
                                                            <asp:Button ID="btnFillter" runat="server" CssClass="submitbutton" 
                                                    Text="Fillter" onclick="btnFillter_Click" Width="70px" />
</td>
											            <td><asp:Button ID="btnReset" runat="server" CssClass="submitbutton" Text="Reset" 
                                                    onclick="btnReset_Click" Width="70px" /></td>
											        </tr>
											    </table>
											 
                                               
                                                
                                                </td>
										</tr>
									</table>
									</td>
								
							</tr>
							<tr>
								<td>
									<input class="submitbutton" name="commit" 
                                        onclick='javascript:SelectAllCheckBox();'  value="Check All" 
                                        style="width: 80px" />&nbsp;
									<input class="submitbutton" name="commit" 
                                        onclick='javascript:DeselectAllCheckBox();' value="UnCheck All" 
                                        style="width: 80px" />&nbsp;
								    <script type='text/javascript'>
								        function SelectAllCheckBox()
								        {
								            var arrChk= document.getElementById('selectAllCheckBox').getElementsByTagName("input");
								          
								            for(var i=0;i<arrChk.length;i++)
								            {
								                if(arrChk[i].id.indexOf("chkSelect")>0)
								                {								                 
								                    arrChk[i].checked=true;
								                }
								            }								        
								        }
								        function DeselectAllCheckBox()
								        {
								            var arrChk= document.getElementById('selectAllCheckBox').getElementsByTagName("input");
								            for(var i=0;i<arrChk.length;i++)
								            {
								                if(arrChk[i].id.indexOf("chkSelect")>0)
								                {
								                    arrChk[i].checked=false;
								                }
								            }	
								        }
								    </script>	
							    </td>
								<td colspan="2" align="right">
                                    <asp:Button ID="btnPrivate" runat="server" CssClass="submitbutton" 
                                        Text="Private" onclick="btnPrivate_Click" 
                                        onclientclick="return confirm('Are you want to change to private?')" 
                                        Width="90px" />
                                    <asp:Button ID="btnApproved" runat="server" CssClass="submitbutton" 
                                        Text="Approved" onclick="btnApproved_Click"
                                        onclientclick="return confirm('Are you want to approve?')" Width="90px" />
                                        
                                        <asp:Button ID="btnResetArticle" runat="server" CssClass="submitbutton" 
                                        Text="Reset Article" 
                                        onclientclick="return confirm('Are you want to reset article?')" 
                                        Width="90px" onclick="btnResetArticle_Click" />
                                        
                                    <asp:Button ID="btnMakeFeatured" runat="server" CssClass="submitbutton" 
                                        Text="Make Featured" onclick="btnMakeFeatured_Click" 
                                        onclientclick="return confirm('Are you want to change to Featured?')" 
                                        Width="120px" />
                                    <asp:Button ID="btnUploadFeatureImage" runat="server" CssClass="submitbutton" 
                                        Text="Upload Feature Image" onclick="btnUploadFeatureImage_Click" 
                                        onclientclick="return confirm('Are you want to upload?')" Width="140px" />
                                    <asp:Button ID="btnDelete" runat="server" CssClass="submitbutton" 
                                        Text="Delete" onclick="btnDelete_Click" 
                                        onclientclick="return confirm('Are you want to Delete?')" Width="90px"/>
								</td>
								</tr>
					
						</table> 
						<br />
						<div id='selectAllCheckBox'>
						<table style="border:0px; width:100%;">
						    <tr>
						        <td style="width:50%; text-align:center;">
						            &nbsp;</td>
						        <td  style="width:50%; text-align:center;">
						            &nbsp;</td>
						    </tr>
						    <tr>
						        <td style="width:50%; text-align:center;">
						            <asp:Literal ID="ltrStatic" runat='server' Visible='false'></asp:Literal>
						        </td>
						        <td  style="width:50%; text-align:center;">
						            <asp:Literal ID="ltrPaging" runat='server' Visible='false'></asp:Literal>
						            <uc1:AdminPaging ID="AdminPaging1" runat="server" />
						        </td>
						    </tr>
						    <tr>
						        <td colspan='2'>
						        
						    <asp:GridView ID="grvSearchResult" runat="server" AutoGenerateColumns="False"
						     DataKeyNames="ID" GridLines="None">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                        <asp:Literal ID='ltrIDA' runat='server' Text='<%# Eval("ID") %>' Visible='false'></asp:Literal>
                                            <asp:CheckBox ID="chkSelect" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Title">
                                        <ItemTemplate>
                                        <a href='javascript:openWin(<%# Eval("ID") %>,"<%=ckid %>")'>
                                            <%# Eval("UTitle")%>
                                            </a>
                                        </ItemTemplate>
                                        <ItemStyle Width="50%" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Category">
                                        <ItemTemplate>
                                            <a href="#" onmouseover="tooltip.show('<%# Eval("catname") %>');" onmouseout="tooltip.hide();"><%# Eval("MainCatID")%></a>
                                            &nbsp;|&nbsp;
                                            <a href="#" onmouseover="tooltip.show('<%# Eval("subcatname") %>');" onmouseout="tooltip.hide();"><%# Eval("SubCatID")%></a>
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Width="75px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Post Date">
                                        <ItemTemplate>
                                            <%# Convert.ToDateTime(Eval("PostDate")).ToString("MM/dd/yy")%>
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Width="100px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Image">
                                        <ItemTemplate>
                                           <%# Eval("number image")%>                                            
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle HorizontalAlign="Center" />
                                        <ItemStyle Width="80px" />
                                    </asp:TemplateField>
                                     <asp:TemplateField HeaderText="Status">
                                        <ItemTemplate>
                                           <%# Convert.ToBoolean(Eval("IsEdited")) == true ? "Edited" : "Not edit"%>
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Width="90px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Featured">
                                        <ItemTemplate>
                                            <%# Eval("FeaturedType").ToString() == "0" ? "Regular" : "Featured " + Eval("FeaturedType").ToString()%>
                                            
                                        </ItemTemplate>
                                         <ItemStyle Width="90px" Wrap="false" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Action">
                                        <ItemTemplate>
                                        <a href='adm_article_add.aspx?aid=<%# Eval("ID") %>&ckid=<%=ckid %>'
                                        onmouseover="tooltip.show('Chỉnh sửa');" onmouseout="tooltip.hide();">
                                        <img src='../images/ico_edit.gif' />
                                        </a>
                                        <a href='adm_articleDet_upload.aspx?aid=<%# Eval("ID") %>&ckid=<%=ckid %>'
                                         onmouseover="tooltip.show('Upload ảnh chi tiết');" onmouseout="tooltip.hide();">
                                        <img src='../images/ico_picblue.gif' />
                                        </a>
                                        <a href='adm_articleImgList_upload.aspx?aid=<%# Eval("ID") %>&ckid=<%=ckid %>&ta=<%# Eval("kTitle").ToString().Trim().Replace(" ","-")+"-"+Eval("fYear").ToString()+"&cNo="+Eval("ImageNoMainImg")+"&t=list" %>'
                                         style='  <%# Convert.ToInt32(Eval("ImageNoMainImg"))>0?"":"display:none" %>'
                                         onmouseover="tooltip.show('Upload ảnh theo danh sách');" onmouseout="tooltip.hide();">
                                        <img src='../images/ico_picblue.gif'  style='  <%# Convert.ToInt32(Eval("ImageNoMainImg"))>0?"":"display:none" %>' />
                                        </a>
                                            
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Width="90px" Wrap="false" />
                                    </asp:TemplateField>
                                </Columns>
                                <HeaderStyle CssClass="first" />
                                <AlternatingRowStyle CssClass="second_se" />
                            </asp:GridView>
						        </td>
						    </tr>
						    </table>
						</div>
						
					</div>
				</div>
</asp:Content>

